<template>
  <div>
    <el-amap vid="amapDemo" :center="center"
             :zoom="zoom" style="height: 800px;"
             :plugin="plugin"
    ></el-amap>
  </div>

</template>

<script>

  export default {
    name: "Online",
    data() {
      return {
        zoom: 16,
        center: [121.59996, 31.197333],
        plugin: [{
          pName: "Geolocation",
          events: {
            init(o) {
              o.getCurrentPosition((status, result) => {
                if (result && result.position) {
                  self.lng = result.position.lng;
                  self.lat = result.position.lat;
                  self.center = [self.lng,self.lat];
                  self.loaded=true;
                }
              })
            }
          }
        }]
      }

    }
  }
</script>
